package com.spica.platform.user.service.impl;

import com.spica.platform.base.model.SysRole;
import com.spica.platform.db.service.impl.ServiceImpl;
import com.spica.platform.user.mapper.SysUserRoleMapper;
import com.spica.platform.user.model.SysUserRole;
import com.spica.platform.user.service.ISysUserRoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements ISysUserRoleService {

	@Resource
	private SysUserRoleMapper sysUserRoleMapper;

	@Override
	public List<SysRole> findRolesByUserId(Long userId) {
		return sysUserRoleMapper.selectRolesByUserId(userId);
	}

	@Override
	public int deleteUserRole(Long userId, Long roleId) {
		return sysUserRoleMapper.deleteUserRole(userId, roleId);
	}

	@Override
	public List<SysRole> findRolesByUserIds(List<Long> userIds) {
		return sysUserRoleMapper.selectRolesByUserIds(userIds);
	}
}
